package com.bocai.freeman.view.activitys;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;

import com.bocai.freeman.R;
import com.bocai.freeman.base.BaseActivity;
import com.bocai.freeman.utils.ToolbarHelper;
import com.bocai.freeman.view.adapter.MyBalanceAdapter;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by admin on 2016/5/19.
 * 我的余额
 */
public class MyBalanceActivity extends BaseActivity {

    @Bind(R.id.lv)
    ListView mLv;

    private View headView;
    private TextView mCharge,mWithdraw;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_balance);
        ButterKnife.bind(this);
        initView();
        initEvent();
    }

    @Override
    protected void initView() {
        super.initView();
        headView = LayoutInflater.from(this).inflate(R.layout.headview_my_balance,null);
        mCharge = (TextView) headView.findViewById(R.id.tv_charge);
        mWithdraw = (TextView) headView.findViewById(R.id.tv_withdraw);
    }

    @Override
    protected void initEvent() {
        super.initEvent();
        ToolbarHelper.setup(this,R.string.my_balance,R.mipmap.left_return);
        mLv.addHeaderView(headView);
        mLv.setAdapter(new MyBalanceAdapter(this));

        click(mCharge).subscribe(o -> {});
        click(mWithdraw).subscribe(o -> startActivity(new Intent(MyBalanceActivity.this,WithdrawActivity.class)));
    }

    @Override
    public void setData(Object obj) {

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ButterKnife.unbind(this);
    }
}
